package com.toy.query;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.format.annotation.DateTimeFormat;


@Getter
@Setter
public class BaseQuery {
    private Log log = LogFactory.getLog(BaseQuery.class);
    private Long id;
    private Long createId;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Long gmtCreate;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Long gmtModified;
    private String goodsName;
    private Integer pageNum;
    private Integer pageSize;
    private Object moudle;
    private Integer totalPage;
    private Integer defaultPageSize = 10;
    private Integer defaultCurrentPage = 1;

    private Integer page;//easyUI请求参数
    private Integer rows;//easyUI请求参数

    public Integer getPageNum() {
        if (null == page) {
            return defaultCurrentPage;
        }else if (null != pageNum) {
            return  pageNum;
        } else {
         return page;
        }
    }


    public Integer getPageSize() {
        if (null == rows) {
            return defaultPageSize;
        }else if (null != pageSize) {
            return  pageSize;
        } else {
         return rows;
        }
    }


}
